﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Composite.SafeDept
{
    public class SafeDept : ISafeDept
    {
        string name;
        List<ISafeDept> deptList;
        public SafeDept(string name)
        {
            this.name = name;
            deptList = new List<ISafeDept>();
        }
        public void AddDept(ISafeDept dept)
        {
            this.deptList.Add(dept);
        }
        public void RemoveDept(ISafeDept dept)
        {
            this.deptList.Remove(dept);
        }
        public List<ISafeDept> GetChild()
        {
            return this.deptList;
        }
        public void Display(string pre)
        {
            System.Console.Write(pre + name + "\n");
            foreach (var item in this.deptList)
            {
                item.Display(pre + "----");
            }
        }
    }
}
